home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_03 / stout / filtdemo.cpp < prev    next >
C/C++ Source or Header  |  1995-02-06  |  799b  |  33 lines

  1. //
  2. //  FILTDEMO.CPP - "Olympic" vs. averaging filter demo
  3. //
  4. //  Performs "Olympic" and averaged filter of command line data
  5. //
  6.  
  7. #include <iostream.h>
  8. #include "olymfilt.hpp"
  9. #include "avgfilt.hpp"
  10.  
  11. main(int argc, char *argv[])
  12. {
  13.       int n;
  14.       short *bufptr;
  15.       size_t len;
  16.       OlympicFilt_T     OlyBuf(OBUF_SMALL);
  17.       AvgFilt_T         AvgBuf;
  18.  
  19.       while (--argc)
  20.       {
  21.             n = atoi(*++argv);
  22.             cout << "Adding " << n << " returned " <<
  23.                   (int)OlyBuf.add(n) << endl;
  24.       }
  25.       cout << "\nOlympic average is " << OlyBuf.OlympicFilt() << endl;
  26.       OlyBuf.export(&bufptr, &len);
  27.       AvgBuf.import(bufptr, len);
  28.       cout << "\nStraight average is " << AvgBuf.AvgFilt() << endl;
  29.       return EXIT_SUCCESS;
  30. }
  31.  
  32.  
  33.